using System;
using System.Data;
using PCSComUtils.PCSExc;
using PCSComUtils.Common;
using PCSComProduct.Costing.DS;
using System.Runtime.InteropServices;

namespace PCSComProduct.Costing.BO
{
	public interface ICostCenterRateBO 
	{
		DataTable ListCostCenter();
		DataSet ListPeriodRate(int pintCCNID, int pintCostCenterID);
		object GetObjectVOCostCenter(string pstrCostCenterCode);
	}

	/// <summary>
	/// Summary description for .
	/// </summary>
	[Guid("85EF10A9-A7F7-4c3b-A277-B096FC99C071")]
	//[Transaction(TransactionOption.Required)]
	public class CostCenterRateBO //: ICostCenterRateBO
	{
		private const string THIS = "PCSComProduct.Costing.BO.CostCenterRateBO";
		public CostCenterRateBO()
		{
			//
			// TODO: Add constructor logic here
			//
		}


		//**************************************************************************              
		///    <Description>
		///			Add new costcenterRate for a costcenter and ccn
		///    </Description>
		///    <Inputs>
		///    </Inputs>
		///    <Outputs>
		///    </Outputs>
		///    <Returns>
		///       void
		///    </Returns>
		///    <Authors>
		///       TuanDm
		///    </Authors>
		///    <History>
		///       Monday, Mar 14, 2005
		///    </History>
		///    <Notes>
		///    </Notes>
		//**************************************************************************
		public void Add(object pObjectDetail)
		{
			// TODO:  Add CostCenterRateBO.Add implementation
			try
			{
				ITM_CostCenterRateDS dsCostCenterRate = new ITM_CostCenterRateDS();
				dsCostCenterRate.Add(pObjectDetail);
			}	
			catch (PCSDBException ex)
			{
				throw ex;
			}
			catch (Exception ex)
			{
				throw ex;
			}
		}
	
		public void Delete(object pObjectVO)
		{
			// TODO:  Add CostCenterRateBO.Delete implementation

		}

		public object GetObjectVO(int pintID, string VOclass)
		{
			// TODO:  Add CostCenterRateBO.GetObjectVO implementation
			return null;
		}


		//**************************************************************************              
		///    <Description>
		///		Get CostCenter object by Code
		///    </Description>
		///    <Inputs>
		///		pstrCostCenterCode : CostCenter Code
		///    </Inputs>
		///    <Outputs>
		///    </Outputs>
		///    <Returns>
		///       void
		///    </Returns>
		///    <Authors>
		///       TuanDm
		///    </Authors>
		///    <History>
		///       Monday, Mar 14, 2005
		///    </History>
		///    <Notes>
		///    </Notes>
		//**************************************************************************
		//[AutoComplete(true)]
		public object GetObjectVOCostCenter(string pstrCostCenterCode)
		{
			// TODO:  Add CostCenterRateBO.GetObjectVO implementation
			try
			{
				ITM_CostCenterDS dsCostCenter = new ITM_CostCenterDS();
				return dsCostCenter.GetObjectVO(pstrCostCenterCode);
			}
			catch (PCSDBException ex)
			{
				throw ex;
			}
			catch (Exception ex)
			{
				throw ex;
			}
		}
	
		public void Update(object pObjectDetail)
		{
			// TODO:  Add CostCenterRateBO.Update implementation

		}

		//[AutoComplete(true)]

		//**************************************************************************              
		///    <Description>
		///			Updata dataset
		///    </Description>
		///    <Inputs>
		///    </Inputs>
		///    <Outputs>
		///    </Outputs>
		///    <Returns>
		///       void
		///    </Returns>
		///    <Authors>
		///       TuanDm
		///    </Authors>
		///    <History>
		///       Thursday, Mar 10, 2005
		///    </History>
		///    <Notes>
		///    </Notes>
		//**************************************************************************
		public void UpdateDataSet(DataSet dstData)
		{
			// TODO:  Add CostCenterRateBO.UpdateDataSet implementation
			try
			{
				ITM_CostCenterRateDS dsCostCenterRate = new ITM_CostCenterRateDS();
				dsCostCenterRate.UpdateDataSet(dstData);
			}
			catch (PCSDBException ex)
			{
				throw ex;
			}
			catch (Exception ex)
			{
				throw ex;
			}
		}


		//**************************************************************************              
		///    <Description>
		///			Get list CostCenter
		///    </Description>
		///    <Inputs>
		///    </Inputs>
		///    <Outputs>
		///    </Outputs>
		///    <Returns>
		///       DataTable
		///    </Returns>
		///    <Authors>
		///       TuanDm
		///    </Authors>
		///    <History>
		///       Wednesday, Mar 09, 2005
		///    </History>
		///    <Notes>
		///    </Notes>
		//**************************************************************************
		//[AutoComplete(true)]
		public DataTable ListCostCenter()
		{
			try
			{
				ITM_CostCenterDS dsCostCenter = new ITM_CostCenterDS();
				return dsCostCenter.List().Tables[ITM_CostCenterTable.TABLE_NAME];
			}
			catch (PCSDBException ex)
			{
				throw ex;
			}
			catch (Exception ex)
			{
				throw ex;
			}
		}


		//**************************************************************************              
		///    <Description>
		///		 Search period costcenterrate of the coscenter and ccn
		///    </Description>
		///    <Inputs>
		///    </Inputs>
		///    <Outputs>
		///    </Outputs>
		///    <Returns>
		///       void
		///    </Returns>
		///    <Authors>
		///       TuanDm
		///    </Authors>
		///    <History>
		///       Thursday, Mar 10, 2005
		///    </History>
		///    <Notes>
		///    </Notes>
		//**************************************************************************
		//[AutoComplete(true)]
		public DataSet ListPeriodRate(int pintCCNID, int pintCostCenterID)
		{
			try
			{
				ITM_CostCenterRateDS dsCostCenterRate = new ITM_CostCenterRateDS();
				return dsCostCenterRate.ListByCCNAndCostCenter(pintCCNID, pintCostCenterID);
			}
			catch (PCSDBException ex)
			{
				throw ex;
			}
			catch (Exception ex)
			{
				throw ex;
			}
		}
		
	}
}
